/*
 * @Author: TT-hzy
 * @Date: 2024-07-29 15:31:25
 * @LastEditors: TT-hzy
 * @LastEditTime: 2024-08-01 17:46:29
 */

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
//配置路径别名
import path from 'path'
const pathSrc = path.resolve(__dirname, 'src')
//自动导入插件
import AutoImport from 'unplugin-auto-import/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    AutoImport({
      imports: ['vue', 'vue-router'],
      dts: 'src/types/auto-imports.d.ts'
    })
  ],

  resolve: {
    alias: {
      '@': pathSrc
    },
    extensions: ['.js', '.ts', '.vue', '.json', '.less', '.css'],
    dedupe: ['vue', 'vue-router']
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        //支持直接使用表达式 width: 100px - 20px;得到值为width:80px;
        math: 'always'
      }
    }
  }
})
